package com.huawei.hwid.usecase;

import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import com.huawei.hwid.UseCase;
import com.huawei.hwid.core.d.b.e;
import com.huawei.hwid.core.d.g;

public class CompressPictureCase extends UseCase<RequestValues> {
    private Context a;

    public static final class RequestValues extends com.huawei.hwid.UseCase.RequestValues {
        public static final Creator<RequestValues> CREATOR = new Creator<RequestValues>() {
            public /* synthetic */ Object createFromParcel(Parcel parcel) {
                return a(parcel);
            }

            public /* synthetic */ Object[] newArray(int i) {
                return a(i);
            }

            public RequestValues a(Parcel parcel) {
                return new RequestValues(parcel);
            }

            public RequestValues[] a(int i) {
                return new RequestValues[i];
            }
        };
        Uri a;

        public RequestValues(Uri uri) {
            this.a = uri;
        }

        protected RequestValues(Parcel parcel) {
        }

        public int describeContents() {
            return 0;
        }

        public void writeToParcel(Parcel parcel, int i) {
        }
    }

    public /* synthetic */ void b(com.huawei.hwid.UseCase.RequestValues requestValues) {
        a((RequestValues) requestValues);
    }

    public CompressPictureCase(Context context) {
        this.a = context;
    }

    protected void a(RequestValues requestValues) {
        e.b("CompressPictureCase", "startCompressPic", true);
        if (requestValues == null || requestValues.a == null) {
            b().b(new Bundle());
            return;
        }
        e.b("CompressPictureCase", "startCompressPic requestValues.mFromUri ", true);
        Parcelable a = com.huawei.hwid.f.e.a(this.a);
        if (a == null) {
            b().b(new Bundle());
            return;
        }
        e.b("CompressPictureCase", "startCompressPic tmpUri", true);
        g.a(this.a, requestValues.a, a, false);
        if (com.huawei.hwid.f.e.a(this.a, a.getPath(), 5120, a.getPath())) {
            Bundle bundle = new Bundle();
            bundle.putParcelable("request_pic_uri_tag", a);
            b().a(bundle);
            return;
        }
        b().b(new Bundle());
    }
}
